<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // //原型继承
        // function Animal(){
        //     this.sex = 'man'
        //     this.eat = function () {
        //         console.log('eat')
        //     }
        // }
        // Animal.prototype = {aaa:100}
        // function Humen(name,age){
        //     this.name = name
        //     this.age = age
        // }
        // Humen.prototype = new Animal()
        // var xiaoming = new Humen('小明',22)
        // var xiaohong = new Humen('小红',20)
        // xiaohong.__proto__.sex = 'woman'

        // console.log(xiaohong)
        // console.log(xiaoming)


        // function Animal(){
        //     this.sex = 'man'
        //     this.eat = function() {
        //         console.log('eat')
        //     }
        // }
        // Animal.prototype = {aaa:100}
        // function Humen(name,age) {
        //     this.name = name
        //     this.age =age
        //     Animal.call(this)
        // }
        // var xiaoming = new Humen('小明',22)


        //zuhejicheng
        function Animal(){
            this.sex = 'man'
            this.eat = function() {
                console.log('eat')
            }
        }
        Animal.prototype = {aaa:100}
        var obj = Object.create(Animal.prototype)
        function Humen(name,age) {
            this.name = name
            this.age =age
            Animal.call(this)
        }
        Humen.prototype = new Animal()




        function Animal(){
            this.sex = 'man'
            this.eat = function() {
                console.log('eat')
            }
        }
        Animal.prototype = {aaa:100}
        var obj = Object.create(Animal.prototype)
        function Humen(name,age) {
            this.name = name
            this.age =age
            Animal.call(this)
        }
        Humen.prototype = obj
    </script>
</body>
</html>